from common.connect_db import MyDB

my_db = MyDB()


class DataBaseMicroShop:

    @staticmethod
    def get_order_sn(rand_num):
        sql = "select ordersn " \
              "from `microshop`.micro_shop_shop_orders " \
              "where rand_num='%s'" % rand_num
        result = my_db.execute_select('microshop', sql)
        if len(result) == 1:
            return result[0].ordersn
        else:
            raise ValueError('为查询到记录')